package src.schoolWork;

import java.io.File;
import java.util.Date;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: tao
 * Date: 2023-11-20
 * Time: 16:31
 */
public class Test4 {
    public static void main(String[] args) {
        String filename = "D:\\桌面\\java\\学校作业\\First.txt";
        File file = new File(filename);

        if (file.exists()) {
            System.out.println("文件存在");
            System.out.println("文件名：" + file.getName());
            System.out.println("路径：" + file.getAbsolutePath());
            System.out.println("文件长度：" + file.length() + "字节");
            System.out.println("最后修改时间：" + new Date(file.lastModified()));
        } else {
            System.out.println("文件不存在");
        }
    }

}
